﻿using System;
using System.Windows;
using System.Windows.Controls;
using GoogleReaderToDelicious.Core.Helpers;
using GoogleReaderToDelicious.WPF.ViewModels;

namespace GoogleReaderToDelicious.WPF.Views
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
            

        }

        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                this.DataContext = new MainWindowViewModel();
            }
            catch (Exception ex)
            {

                MessageBox.Show("Error "+ex.Message);
            }
        }

        private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e)
        {
            var vm = (MainWindowViewModel) this.DataContext;
            vm.Password = ((PasswordBox) sender).Password;
        }
        

       


    }
}
